package collection.homework.Demo4;

import java.util.Objects;

/*
  订单项类
 */
public class ProductItem implements Comparable<ProductItem> {
    //订单项id
    private int orderId;
    //订单项编号
    private int orderIdNumber;
    //商品编号
    private int productNumber;
    //商品名称
    private String productName;
    //商品价格
    private double price;

    public ProductItem() {
    }

    public ProductItem(int orderId, int orderIdNumber, int productNumber, String productName, double price) {
        this.orderId = orderId;
        this.orderIdNumber = orderIdNumber;
        this.productNumber = productNumber;
        this.productName = productName;
        this.price = price;
    }

    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    public int getOrderIdNumber() {
        return orderIdNumber;
    }

    public void setOrderIdNumber(int orderIdNumber) {
        this.orderIdNumber = orderIdNumber;
    }

    public int getProductNumber() {
        return productNumber;
    }

    public void setProductNumber(int productNumber) {
        this.productNumber = productNumber;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "ProductItem{" +
                "orderId=" + orderId +
                ", orderIdNumber=" + orderIdNumber +
                ", productNumber=" + productNumber +
                ", productName='" + productName + '\'' +
                ", price=" + price +
                '}';
    }


    @Override
    public int compareTo(ProductItem o) {
        return this.orderId - o.orderId;
    }
}

